Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the functional requirements mentioned in the ticket #75.
The goal is to automatically restart or reload the config of all the geOrchestra applications when there is a new commit in the geOrchestra datadir. That would allow for easier management of the datadir in test environments.
The implementation includes a new component (datadirsync) that is deployed with certain permissions to access the
kubernetes API.
This component implements python code that actively listens to a given git repository, in a certain branch, at defined time intervals looking for changes in the repository. If this happens, it then invokes through the k8s API the rollout of the deployments listed in the deploymentSuffixNameList variable considering the predefined namespace.
Since in the context of Georchestra the SDI components update the datadir at initialization (https://github.com/georchestra/helm-georchestra/blob/main/templates/_bootstrap-georchestra-datadir.tpl) the rollout of a component guarantees that when restarting, it reloads the necessary configuration information.
The template accepts the definition of the username and password of the user with which the checks are made on the git repository, or that an sshkey is used (in which case it will be included in the corresponding container).
For details of the logic, review the template/datadirsync-deployment.yaml file.
The python implementation that executes the repository status check actions is momentarily in the following repository/folder https://github.com/jemacchi/simple-git-rollout-operator/tree/main/operator .
Initially, it was expected to perhaps create a somewhat more robust solution, but since it is a component that is not expected to be used in production environments, a simpler solution was chosen, which makes use of the Kubernetes API natively, with a component that does not involve CRD installation, and that has the minimum and necessary RBAC permissions to perform the relevant action.